package ute.mvc.controller.portal.lecturer;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import ute.mvc.model.OpenCourse;
import ute.mvc.service.OpenCourseService;

@Controller
@RequestMapping(value = { "/lecturer/{lecturerId}/{openCourseId}" })
public class LecturerCourseController {

	@Autowired
	OpenCourseService openCourseService;
	
	@RequestMapping(value = "/", method = RequestMethod.GET)
	public String getCourseHome(@PathVariable int lecturerId,
			@PathVariable String openCourseId, Model model) {

		//Get OpenCourse
		OpenCourse ocourse = openCourseService.getOpenCourseById(openCourseId);
		model.addAttribute("ocourse", ocourse);

		return "opencourse_home";
	}

}
